<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>账号与安全</title>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css">
</head>
<body>
<div class="container mt-5">
    <h2>账号与安全</h2>
    
    <!-- 币数和签到功能 -->
    <div class="card mb-4 border-primary">
        <div class="card-header bg-primary text-white">
            <h4 class="mb-0">签到赚币</h4>
        </div>
        <div class="card-body">
            <h5 class="card-title">当前币数: <span class="badge bg-success">{{ coins }} 个</span></h5>
            <p class="card-text">每日签到可获得1个币，连续签到有额外奖励</p>
            {% if has_checked_in %}
                <div class="alert alert-success">
                    <i class="bi bi-check-circle-fill"></i> 今日已签到，明天再来吧！
                </div>
            {% else %}
                <form action="/check_in" method="post">
                    <button type="submit" class="btn btn-primary btn-lg">
                        <i class="bi bi-coin"></i> 每日签到 (+1币)
                    </button>
                </form>
            {% endif %}
        </div>
    </div>
    <div class="mb-3">
        <label class="form-label">邮箱：</label>
        <span>{{ current_user.email }}</span>
    </div>
    <div class="mb-3">
        <label class="form-label">用户名：</label>
        <span>{{ current_user.username or '未设置' }}</span>
        <a href="/set_username" class="btn btn-sm btn-outline-primary ms-2">设置/修改</a>
    </div>
    <div class="mb-3">
        <label class="form-label">两步验证(2FA)：</label>
        {% if current_user.otp_enabled %}
            <span class="text-success">已启用</span>
            <a href="/account/security/2fa" class="btn btn-sm btn-outline-warning ms-2">管理</a>
        {% else %}
            <span class="text-danger">未启用</span>
            <a href="/account/security/2fa" class="btn btn-sm btn-outline-danger ms-2">立即启用</a>
        {% endif %}
    </div>
    
    <div class="mb-3">
        <label class="form-label">密保问题：</label>
        {% if current_user.security_question1 %}
            <span class="text-success">已设置</span>
            <a href="{{ url_for('security_questions') }}" class="btn btn-sm btn-outline-primary ms-2">修改</a>
        {% else %}
            <span class="text-danger">未设置</span>
            <a href="{{ url_for('security_questions') }}" class="btn btn-sm btn-outline-primary ms-2">设置</a>
        {% endif %}
    </div>
    <div class="mb-3">
        <label class="form-label">微信绑定：</label>
        {% if current_user.wx_openid %}
            <span class="text-success">已绑定</span>
        {% else %}
            <a href="/bind_wechat" class="btn btn-sm btn-outline-success">扫码绑定</a>
        {% endif %}
    </div>
    <div class="mb-3">
        <label class="form-label">QQ绑定：</label>
        {% if current_user.qq_openid %}
            <span class="text-success">已绑定</span>
        {% else %}
            <a href="/bind_qq" class="btn btn-sm btn-outline-info">扫码绑定</a>
        {% endif %}
    </div>
    
    <div class="mb-3">
        <label class="form-label">创作者：</label>
        {% if current_user.is_creator %}
            <a href="{{ url_for('creator_center') }}" class="btn btn-sm btn-outline-success">创作者中心</a>
        {% else %}
            <a href="{{ url_for('apply_creator') }}" class="btn btn-sm btn-outline-primary">申请成为创作者</a>
        {% endif %}
    </div>
    
    <!-- 注销账号功能 -->
    <div class="card border-danger mt-4">
        <div class="card-header bg-danger text-white">
            <h4 class="mb-0">账号注销</h4>
        </div>
        <div class="card-body">
            <h5 class="card-title text-danger">危险操作</h5>
            <p class="card-text">注销账号将永久删除您的所有数据，包括：</p>
            <ul>
                <li>个人信息</li>
                <li>签到记录</li>
                <li>群聊记录</li>
                <li>帖子内容</li>
            </ul>
            <button type="button" class="btn btn-danger" data-bs-toggle="modal" data-bs-target="#confirmDeleteModal">
                注销账号(无法注销，因为没做)
            </button>
        </div>
    </div>
    
    <!-- 确认注销模态框 -->
    <div class="modal fade" id="confirmDeleteModal" tabindex="-1" aria-labelledby="confirmDeleteModalLabel" aria-hidden="true" aria-modal="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header bg-danger text-white">
                    <h5 class="modal-title" id="confirmDeleteModalLabel">确认注销账号</h5>
                    <button type="button" class="btn-close" data-bs-close="modal" aria-label="Close"></button>
                </div>
                <div class="modal-body">
                    <p>您确定要永久注销账号吗？此操作不可撤销！</p>
                    <form id="deleteAccountForm" action="/account/delete" method="post">
                        <div class="mb-3">
                            <label for="password" class="form-label">请输入密码确认：</label>
                            <input type="password" class="form-control" id="password" name="password" required>
                        </div>
                    </form>
                    <script>
                        document.getElementById('deleteAccountForm').addEventListener('submit', function(e) {
                            console.log('删除账号表单已提交');
                        });
                    </script>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">取消</button>
                    <button type="submit" form="deleteAccountForm" class="btn btn-danger">确认注销</button>
                </div>
            </div>
        </div>
    </div>
    
    <a href="/" class="btn btn-link">返回首页</a>
</div>
</body>
</html>
